import { useEffect } from 'react';

/**
 * A custom hook to update the document title
 * 
 * @param title The title to set for the document
 * @param suffix Optional suffix to append to the title (defaults to site name)
 */
const useTitle = (title: string, suffix: string = '智慧教室系统') => {
  useEffect(() => {
    document.title = suffix ? `${title} - ${suffix}` : title;
    
    return () => {
      // Optionally restore previous title on unmount
    };
  }, [title, suffix]);
};

export default useTitle; 